package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.ProductCommentCUDClient;
import com.zqh.myfmmall.result.Result;
import com.zqh.myfmmall.rowbeans.entity.ProductComments;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-16 21:30
 */
@Slf4j
public class ProductCommentCUDClientFallback implements FallbackFactory<ProductCommentCUDClient>{
    @Override
    public ProductCommentCUDClient create(Throwable cause) {
        log.warn("exception in calling productcommentcud service:"+cause);
        return new ProductCommentCUDClient(){
            @Override
            public Result create(ProductComments productComments) {
                return Result.internalServerError();
            }

            @Override
            public Result update(ProductComments productComments) {
                return Result.internalServerError();
            }

            @Override
            public Result delete(String id) {
                return Result.internalServerError();
            }
        };
    }
}
